<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.jiabonet.DB.staticBean"%>
<%
	String path = request.getContextPath();
	String Admin = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + staticBean.getAdminDir();
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>产品出库管理</title>
		<link href="<%=path%>/Public/css/AdminCss.css" rel="stylesheet" type="text/css" />
		<script src="<%=path%>/Public/js/jquery.min.js" type="text/javascript"></script>
		<script src="<%=path%>/Public/js/jquery.form.js"></script>
		<script src="<%=path%>/Public/js/Ajax.js" type="text/javascript"></script>
<script type="text/javascript">
	var allbox = new Array();
	$(function(){
		
		$("#tables tr").hover(
		  function () {
			$(this).css("background","#d5f4fe");
		  },
		  function () {
			$(this).css("background","#fff");
		  }
		);

		var StartPage = $("#StartPage");
		var Start = $("#Start");
		Start.click(function(){
			window.location.href="<%=path%>/Delivery!Delivery_Lists.action?page.GetPage="+parseInt(StartPage.val());
		});

		$("input[name='checkbox11']").click(function() {
            $('[id="checkbox10"]').attr("checked",this.checked);             
            if($(this).attr("isAllCheck") == "true") {
				$('[id="checkbox10"]').removeAttr("isCheck");
				$(this).removeAttr("isAllCheck");
			} else {
				$('[id="checkbox10"]').attr("isCheck", "true");
				$(this).attr("isAllCheck","true");
			}
        });
		
		$('[id="checkbox10"]').click(function(){
			if($(this).attr("isCheck") == "true") { 
				$(this).removeAttr("isCheck") 
			} else { 
				$(this).attr("isCheck", "true"); 
			} 
		});
		var DelAll = $("#DelAll");
		DelAll.click(function(){
        	getValues();
        	if(allbox.length<=0){
            	alert("请选中要删除的数据！");
		        return false;
            }
        	if (confirm("确认要选中的数据删除？")) {
                var GetPage = $("input[name='GetPage']").val();
            	$.ajax({
     			   type: "POST",
     			   url: "<%=path%>/Delivery!Delivery_DelAll.action?T="+Math.random(),
     			   data: "delivery.DelAll="+allbox+"&page.GetPage="+GetPage,
     			   success: function(msg){
    					alert(msg.returnInfo);
    					window.location.href="<%=path%>/Delivery!Delivery_Lists.action?page.GetPage="+msg.page.getPage;
    					//alert(msg);
    		 		}
     			});
            }
        });

		AjaxPost(CheckFormFun,"<%=path%>/Delivery!Delivery_Keys.action?T="+Math.random(),"Fm_Deliverys",returnAddFun,false);
		
       
	});

	function CheckFormFun(){//在表彰提交之前，验证数据
		var Keywords = $("#Keywords");
		if(Keywords.val().length <= 0){alert("关键字不能为空！");Keywords.focus(); return false;}
		
	}

	function returnAddFun(msg){//返回数据
		if(msg==0){
			alert("没有找到查询的数据！");	
		}else{
			var tables = $("#tables tr");
			tables.remove();
			$("#tables").append(trim(msg));//将返回的数据追加到表格中
		}
	}
	
	function getValues() 
	{ 
		allbox = [];//将数组清空
		$('[id="checkbox10"]').each(function(){ 
			if($(this).attr("isCheck") == "true"){ 
				allbox.push($(this).val()); 
			}
		});
		//alert(allbox);
		/*
		var alls="";
		
		for(var i=0;i<allbox.length;i++){
			alls+=allbox[i]+",";
		}
		alert(alls);
		*/
	}
	
	function selectManage(Ids){
		var showWi = window.showModalDialog("Delivery!Delivery_Edit.action?delivery.Id="+Ids+"&T="+Math.random(), null,"dialogWidth=780px;dialogHeight=490px;status=no;help=no;scrollbars=no;location=no;frame=no;");   
	}


	function trim(str){ //删除左右两端的空格
		　　return str.replace(/(^\s*)|(\s*$)/g, "");
	}
	
</script>


	</head>

	<body>
		<table width="100%" border="0" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="30px">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td height="24px" bgcolor="#353c44">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="22%">
											<table width="77%" border="0" cellspacing="0"
												cellpadding="0">
												<tr>
													<td width="6%" height="19" valign="center">
														<div align="center">
															<img src="<%=Admin%>/images/tb.gif" width="14"
																height="14" />														</div>													</td>
													<td width="94%" valign="center">
														<span class="STYLE1"> 出库基本信息列表</span>													</td>
												</tr>
											</table>										
										</td>
										<form id="Fm_Deliverys" name="Fm_Deliverys" method="post" action="">
										<td width="39%">
										<span class="STYLE1">
											<select name="delivery.Keys" style="width:120px;">
												<option value="Date">日期时间</option>
												<option value="Barcode">产品条码</option>
												<option value="Name">产品名称</option>
											</select>
											&nbsp;<input type="text" value="" name="delivery.Keywords" id="Keywords" maxlength="24" size="20" />
											&nbsp;<input type="submit" value="搜索" name="selects"/>
										</span>
										</td>
										</form>
										
<td width="39%"><div align="right">
												<span class="STYLE1"> &nbsp;&nbsp;<img
														src="<%=Admin%>/images/add.gif" width="10" height="10" />
													<a href="Delivery!Delivery_List.action" class="STYLE1">产品出库</a>
													&nbsp; <a href="#" id="DelAll" class="STYLE1"><img
															src="<%=Admin%>/images/del.gif" width="10" height="10" />
														删除 </a>&nbsp;&nbsp;<img src="<%=Admin%>/images/edit.gif"
														width="10" height="10" /><a href="#" id="Generate" class="STYLE1">生成订单</a>
													&nbsp;</span>											</div></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr>
				<td>
					<table width="100%" border="0" cellpadding="0" cellspacing="1"
						bgcolor="#a8c7ce" id="tables">
						<tr>
							<td width="6%" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">产品大类</span>
								</div>
							</td>
							<td width="9%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">产品名称</span>
								</div>
							</td>
							<td width="6%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">产品规格</span>
								</div>
							</td>

							<td width="11%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">产品条码</span>
								</div>
							</td>
							<td width="9%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">出货日期</span>
								</div>
							</td>
							<td width="6%" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">出货数量</span>
								</div>
							</td>

							<td width="7%" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">出货单价</span>
								</div>
							</td>
							<td width="8%" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">出货总额</span>
								</div>
							</td>
							<td width="11%" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">已付金额</span>
								</div>
							</td>
							<td width="8%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">欠款金额</span>
								</div>
							</td>
							<td width="9%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">供货商</span>
								</div>
							</td>
							<td width="8%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">出货人</span>
								</div>
							</td>
							<td width="3%" height="20" bgcolor="d3eaef" class="STYLE6">
								<div align="center">
									<span class="STYLE10">
									<input type="checkbox" name="checkbox11" id="checkbox11" />
									</span>
								</div>
							</td>
						</tr>
						<s:iterator value="List" id="content">
						<tr bgcolor="#FFFFFF" id="List">
						
							<td class="STYLE19">
								<div align="center">
									<s:property value="#content.ShopClass" />
								</div>
							</td>
							<td height="20" class="STYLE19">
								<div align="center">
									<a href="#" onclick="selectManage(<s:property value="#content.Id" />);"><s:property value="#content.ShopName" /></a>
								</div>
							</td>
							<td height="20" class="STYLE19">
								<div align="center">
									<s:property value="#content.Type" />
								</div>
							</td>

							<td height="20" class="STYLE19">
								<div align="center">
									<b><a href="#" onclick="selectManage(<s:property value="#content.Id" />);"><s:property value="#content.Barcode" /></a> </b>
								</div>
							</td>
							<td height="20" class="STYLE19">
								<div align="center">
									<s:property value="#content.DeliveryDate" />
								</div>
							</td>
							<td class="STYLE19">
								<div align="center">
									<b><s:property value="#content.Num" /> </b>
								</div>
							</td>
							<td class="STYLE19">
								<div align="center">
									<s:property value="#content.Price" />
								</div>
							</td>
							<td class="STYLE19">
								<div align="center">
								<s:property value="#content.Total" />
								</div>
							</td>
						  <td class="STYLE19">

								<div align="center">
								<s:property value="#content.Payment" />
								</div>
								</td>
							<td height="20" class="STYLE19">
								<div align="center">
									<s:property value="#content.Owe" />
								</div>
							</td>
							<td height="20" class="STYLE19">
								<div align="center">
								<s:property value="#content.Supply" />
								</div>				
							</td>
								<td height="20" class="STYLE19">
									<div align="center">
										<s:property value="#content.DeliveryName" />
									</div>
									</td>
									<td height="20" class="STYLE19">
									<div align="center">
										<input type="checkbox" name="login.checkbox10[]" id="checkbox10" value="<s:property value="#content.Id"/>" />
									</div>
									</td>
					  </tr>
						</s:iterator>
					</table>
				</td>
			</tr>
			
			<tr>
				<td height="30">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="33%">
								<div align="left">
									<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;共有<strong>
											<s:property value="page.ListRow" /></strong> 条记录，当前第<strong> <s:property value="page.GetPage" /><input type="hidden" value="<s:property value="page.GetPage" />" name="GetPage" ></strong> 页，共 <strong> <s:property value="page.intPageCount" /> </strong> 页</span>
								</div>
							</td>
							<td width="67%">
								<table width="312" border="0" align="right" cellpadding="0"
									cellspacing="0">
									<s:url id="url_index" value="Delivery!Delivery_Lists.action">
										<s:param name="page.GetPage" value="1"></s:param>
									</s:url>
									<s:url id="url_pre" value="Delivery!Delivery_Lists.action">
										<s:param name="page.GetPage" value="page.GetPage-1"></s:param>
									</s:url>
									<s:url id="url_next" value="Delivery!Delivery_Lists.action">
										<s:param name="page.GetPage" value="page.GetPage+1"></s:param>
									</s:url>
									<s:url id="url_end" value="Delivery!Delivery_Lists.action">
										<s:param name="page.GetPage" value="page.intPageCount"></s:param>
									</s:url>
									<tr>
										<td width="49">
											<div align="center">
												<s:a href="%{url_index}"><img src="<%=Admin%>/images/main_54.gif" width="40"
													height="15" />
												</s:a>
											</div>
										</td>
										<td width="49">
											<div align="center">
												<s:a href="%{url_pre}">
													<img src="<%=Admin%>/images/main_56.gif" width="45"
														height="15" />
												</s:a>
											</div>
										</td>
										<td width="49">
											<div align="center">
											<s:a href="%{url_next}">
												<img src="<%=Admin%>/images/main_58.gif" width="45"
													height="15" />
											</s:a>
											</div>
										</td>
										<td width="49">
											<div align="center">
											<s:a href="%{url_end}">
												<img src="<%=Admin%>/images/main_60.gif" width="40"
													height="15" />
											</s:a>
											</div>
										</td>
										<td width="37" class="STYLE22">
											<div align="center">
												转到
											</div>
										</td>
										<td width="22">
											<div align="center">
												<input type="text" name="StartPage" id="StartPage" value="" style="width: 20px; height: 12px; font-size: 12px; border: solid 1px #7aaebd;" />
											</div>
										</td>
										<td width="22" class="STYLE22">
											<div align="center">
												页
											</div>
										</td>
										<td width="35">
											<a href="#" id="Start"><img src="<%=Admin%>/images/main_62.gif" width="26"
												height="15" /></a>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>
